/*
 * ProtocolParser.h
 *
 *  Created on: Sep 7, 2017
 *      Author: guoxs
 */
#ifndef _UART_PROTOCOL_PARSER_H_
#define _UART_PROTOCOL_PARSER_H_

#include "ProtocolData.h"

// #define User_DEBUG_PRO_DATA

// #define User_PRO_SUPPORT_CHECK_SUM

#ifdef User_PRO_SUPPORT_CHECK_SUM
#define User_DATA_PACKAGE_MIN_LEN 6
#else
#define User_DATA_PACKAGE_MIN_LEN 9
#endif

// ͬ��֡ͷ
// Sync frame header
#define User_TX_CMD_HEAD1 0x46
#define User_TX_CMD_HEAD2 0xB9
#define User_TX_CMD_HEAD3 0x6A
#define User_TX_CMD_HEAD4 0x00

#define User_RX_CMD_HEAD1 0x46
#define User_RX_CMD_HEAD2 0xB9
#define User_RX_CMD_HEAD3 0x68
#define User_RX_CMD_HEAD4 0x00
#define User_RX_CMD_HEAD5 0x6A

typedef void (*OnProtocolDataUpdateFun)(const SProtocolData &data);

void registerProtocolDataUpdateListener(OnProtocolDataUpdateFun pListener);
void unregisterProtocolDataUpdateListener(OnProtocolDataUpdateFun pListener);

SProtocolData &getProtocolData();

#endif /* _UART_PROTOCOL_PARSER_H_ */
